<template>
  <div id='notice'>
    <com-head :opacity='0'>平台公告</com-head>
    <div class="navimg"  @click="shownav"><img class="img" src="../assets/image/navall.png"></div>
    <!-- 记录 -->
    <div class="notice" v-for="item in notice" :key="item.id" @click="noticeDetail(item.id)">
        <div class="left">
            <p>{{item.news_title}}</p>
            <p>{{item.create_time}}</p>
        </div>
    </div>
  </div>
</template>

<script>
export default {
  name: "notice",
  data() {
    return {
      notice: []
    };
  },

  computed: {},

  created() {},

  mounted() {
    this.loading();
  },

  methods: {
    loading() {
      this.axios
        .post("apiindex/newslist", {
          token: this.token()
        })
        .then(({ data }) => {
          
          if (data.code === "200") {
            this.notice = data.data;
          } else if (data.code === "204") {
            this.$bus.$emit("toast", data.data);
          } else if (data.code === "205") {
            this.$bus.$emit("toast", '暂无数据');
          }
        })
        .catch(function(error) {
          console.log(error);
        });
    },
    shownav() {
      this.$bus.$emit("navlist");
    },
    noticeDetail(id) {
      this.$router.push({name:"noticeDetail",query: {id,id}});
    }
  }
};
</script>
<style lang='scss'>
#notice {
  .icon-fanhui1 {
    display: none;
  }
  .navimg {
    width: 140px;
    height: 80px;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    img {
      display: block;
      margin-left: 42px;
      margin-top: 25px;
      width: 43px;
      height: 33px;
    }
  }
  .notice {
    margin: 0 32px;
    border-bottom: 1Px solid #eee;
    padding: 30px 0 10px 0;
    .left {
      width: 686px;
      p:nth-of-type(1) {
        width: 686px;
        font-size: 34px;
        font-family: PingFangSC-Medium;
        font-weight: 500;
        color: rgba(51, 51, 51, 1);
        line-height: 48px;
        box-sizing: border-box;
        display: -webkit-box;
        -webkit-box-orient: vertical;
        -webkit-line-clamp: 2;
        overflow: hidden;
      }
      p:nth-of-type(2) {
        font-size: 24px;
        color: #888;
        line-height: 70px;
      }
    }
    .right {
      font-size: 40px;
      font-weight: 600;
      color: rgba(34, 34, 34, 1);
      font-family: PingFangSC-Medium;
    }
  }
}
</style>